Skip to content

feat(attest): PCRs 1 and 5 are judged by replaying the firmware event log; the partition table must hold the image's installed disk and nothing else, and the boot variables and loader.conf must be those of the VM's first verified boot - #352

Merged
teemow merged 5 commits into
mainfrom
fix-attestation-pcr1-5
Dec 1, 2026

Conversation

@teemow

@teemow teemow commented Dec 1, 2026

Copy link
Copy Markdown
Member

Closes #316. PCRs 1 and 5 were quoted but not compared, so a change to the firmware's boot configuration or to the disk's partition table went unnoticed. The certified attestation key came in #351.

What changes

PCR 1 and 5 differ per VM, so no golden value can vouch for them. The verifier replays their events instead (internal/attest/bootconfig.go): the firmware event log, then the initrd's os-separator from the userspace log, must reproduce the quoted PCR 1 and PCR 5. Every event must be one a boot vm-manager starts has, bound to its data where the log carries it. What the guest can change is judged:

  • The partition table (PCR 5). The GPT must hold the partitions of the image's installed disk and nothing else: the ESP, slots A and B of root, verity and verity signature, and var. Their types, labels (the image's id and version, or _empty), attributes and counts are checked. A test keeps these rules equal to repart.sysinstall.d. A partition that is added, retyped, relabelled or given another attribute (no-auto, say) fails the boot.
  • The boot variables (PCR 1) and loader.conf (PCR 5). BootOrder, the Boot#### options and systemd-boot's loader.conf must be what the VM's first verified boot measured. The VM's record keeps that measurement (get_vm bootConfig), and each quote shows what it measured (get_vm_attestation). Before that first boot, only vm-manager's installer wrote them. A VM recorded before this release takes the configuration of its next verified boot.
  • Host configuration (PCR 1). The ACPI and SMBIOS tables QEMU builds from vm-manager's arguments, and the SMBIOS structures systemd-boot and systemd-stub measure, are replayed but not compared. The guest cannot write them, and comparing them would fail every VM after a QEMU update on the host.

ExitBootServices may be logged as failed before it succeeds: the kernel's EFI stub calls it again when the memory map changed in between.

Nothing is removed; no flag, value or consumer setting changes.

What ran

  • go test ./... and golangci-lint (also with -tags e2e). The replay tests use the firmware and userspace logs of a first installed boot and its reboot.
  • The full e2e suite: https://github.com/giantswarm/vm-manager/actions/runs/46581118688.
    • Every VM's boots verify PCR 1 and 5, reboots and the golden reference boot included.
    • TestBootConfigAttestation: a reboot verifies against the recorded configuration. Three changes root makes are each refused at the next boot: a boot option's description changed through efivarfs, an empty B slot retyped with sfdisk, and an option added to loader.conf.
  • hack/guest-image-golden.sh with this branch's container image records the golden values; its reference boot and its verify boot both judge PCR 1 and 5.
  • agentlab, with this branch's chart, container image and guest image:
    • agentlab vm-manager-test passes.
    • A VM created through the pod's REST API records its boot configuration on its first boot (a GPT of 5 partitions) and verifies against it after a reboot (8 partitions, first-boot repart added the B slots). Once root edited loader.conf, its next boot was refused: pcr 1 and 5: the boot configuration changed since the vm's first verified boot: loader.conf changed.

… log; the partition table must hold the image's installed disk and nothing else, and the boot variables and loader.conf must be those of the VM's first verified boot

PCR 1 and 5 differ per VM and have no golden values, so the verifier
replays their events from the firmware event log (and the initrd's
os-separator from the userspace log) to the quoted values; every event is
one a boot vm-manager starts has, bound to its data where the log carries
it. The GPT must hold the partitions repart.sysinstall.d lays out (types,
labels, attributes, counts). BootOrder, the Boot#### options and
systemd-boot's loader.conf must be what the VM's first verified boot
measured, which the record keeps (bootConfig). The ACPI and SMBIOS tables
QEMU builds are replayed, not compared.
…es and retypes the slot without re-reading the disk in use
…on from the boot's events, so it skips cleanly without the simulator
@teemow
teemow requested a review from a team as a code owner December 1, 2026 05:50
@teemow
teemow merged commit 5eaecaa into main Dec 1, 2026
26 checks passed
@teemow
teemow deleted the fix-attestation-pcr1-5 branch December 1, 2026 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

attest: the attestation key is trusted on first use, and PCRs 1 and 5 are quoted but not compared

1 participant